package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易状态(1-待支付，2-处理中，3-成功，4-失败)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum BankPayTradeStateEnum {

    WAIT_PAY(1, "待支付"),
    PROCESSING(2, "处理中"),
    SUCCESS(3, "成功"),
    FAIL(4, "失败"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    BankPayTradeStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static BankPayTradeStateEnum typeOf(Integer value) {
        BankPayTradeStateEnum[] values = BankPayTradeStateEnum.values();
        for (BankPayTradeStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static BankPayTradeStateEnum typeOf(String name) {
        BankPayTradeStateEnum[] values = BankPayTradeStateEnum.values();
        for (BankPayTradeStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
